Option Strict On
Option Explicit On 

Imports IP.Core.IPUserService
Imports System.Windows.Forms

Public Class IPSimpleStringComboBoxManager

#Region "CONST"
    Private Const c_display_field_name As String = "HIEN_THI"
    Private Const c_value_field_name As String = "GIA_TRI"
#End Region

#Region "MEMBER"
    Private m_cbo As ComboBox
    Private m_ds_data_source As New DS_IPStringStringSource
#End Region

#Region "PUBLIC"
    Public Sub New(ByVal i_combo As ComboBox)
        Me.m_cbo = i_combo
        m_cbo.DataSource = m_ds_data_source.IP_SS_SIMPLE_DATA_SOURCE
        m_cbo.DisplayMember = c_display_field_name
        m_cbo.ValueMember = c_value_field_name
    End Sub

    Public Sub addItem(ByVal i_str_value As String, ByVal i_str_hien_thi As String)
        Dim v_datarow As DataRow = m_ds_data_source.IP_SS_SIMPLE_DATA_SOURCE.NewRow()
        v_datarow(c_display_field_name) = i_str_hien_thi
        v_datarow(c_value_field_name) = i_str_value
        m_ds_data_source.IP_SS_SIMPLE_DATA_SOURCE.Rows.Add(v_datarow)
        m_ds_data_source.AcceptChanges()
    End Sub
#End Region


#Region "PRIVATE"

    Private Class SelectableItemStringString
        Private m_str_gia_tri As String
        Private m_str_hien_thi As String

        Public Sub New(ByVal i_dc_gia_tri As String, ByVal i_str_hien_thi As String)
            MyBase.New()
            Me.m_str_gia_tri = i_dc_gia_tri
            Me.m_str_hien_thi = i_str_hien_thi
        End Sub

        Public ReadOnly Property GIA_TRI() As String
            Get
                Return m_str_gia_tri
            End Get
        End Property

        Public ReadOnly Property HIEN_THI() As String
            Get
                Return m_str_hien_thi
            End Get
        End Property

        Public Overrides Function ToString() As String
            Return m_str_gia_tri & " - " & m_str_hien_thi
        End Function
    End Class
#End Region


End Class